<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class date_m extends CI_Model{
	
	/**
	 * 获取用户数据
	 * @param array $data  // 筛选条件
	 */
	public function getDateList($data)
	{
		$sql	 = '';
		$implode = array();
		
		if (isset($data['id']) && !empty($data['id'])) {
			$implode[] = "id='" . intval($data['id']) . "'";
		}
		
		if (isset($data['date']) && !empty($data['date'])) {
			$implode[] = "date='" . $data['date'] . "'";
		}
		
		if ($implode) {
			$sql = "WHERE " . implode("AND ", $implode);
		}
		
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "date " . $sql);
		
		return $query->result_array();
	}
	
}